#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
  
int main()
{
 
    printf("stdin:%d\n",stdin->_fileno);
    printf("stdout:%d\n",stdout->_fileno);
    printf("strerr:%d\n",stderr->_fileno);
    printf("strerr:%d\n",stderr->_fileno);


    //char input[16];
    //ssize_t sz = read(0,input,sizeof(input));
    //if(sz > 0)
    //{
    //    input[sz] = '\0';
    //    printf("%s\n",input);
    //}

   // int a = 0;
   // // scanf
   // fscanf(stdin,"%d",&a);
   // printf("%d",a);

    //fprintf(stdout,"hello linux\n");
    //const char* s  = "hello write\n";
    //write(1,s,strlen(s));

   //umask(0);
   //// int fd = open("log.txt",O_RDONLY);
   //// fopen("log.txt","w")
   //// fopen("log.txt","a")
   //// int fd = open("log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666); // rw-rw-rw-
   //// int fd = open("log.txt",O_WRONLY|O_CREAT|O_APPEND,0666); // rw-rw-rw-
   //// int fd = open("log.txt",O_RDONLY);
   //int fd1 = open("log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666); // rw-rw-rw-
   //int fd2 = open("log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666); // rw-rw-rw-
   //int fd3 = open("log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666); // rw-rw-rw-
   //int fd4 = open("log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666); // rw-rw-rw-
   //if(fd1 < 0)
   //{                                                                                    
   //    perror("open");                              
 //    return 1;                         
//}              
   //// const char* s = "hello world\n";
   //// const char* s = "aa\n";
   //// write(fd,s,strlen(s));
   ////char buffer[100];
   ////memset(buffer,'\0',sizeof(buffer));
   ////read(fd,buffer,sizeof(buffer));
   ////printf("%s",buffer);                                 
   //printf("open success, fd = %d\n",fd1);
   //printf("open success, fd = %d\n",fd2);
   //printf("open success, fd = %d\n",fd3);
   //printf("open success, fd = %d\n",fd4);
   //close(fd1);
   //close(fd2);
   //close(fd3);
   //close(fd4);
   //return 0;                           
}                      
  

